var XmlHttp = new Object();   
var element_id = null;
var picture_id = null;
var finish_flg = 0;
function sendSession(url,name,value,ele_id,pic_id){
	finish_flg = 0;
	if(ele_id!=null){
		element_id = ele_id;
		document.getElementById(element_id).disabled = "true";
		//alert("ture");
	}
	if(pic_id!=null){
		picture_id=pic_id
		document.getElementById(picture_id).style.display = "block";
    }
    GetXmlHttp();
	var sendurl = "/" + url + "?sessionName=" + name + "&sessionValue=" + value;
    XmlHttp.onreadystatechange = finish;
	
    XmlHttp.open( "POST", sendurl, true);   
    XmlHttp.send(null);   
    if   (XmlHttp.status   !=   200)   
        alert("server error")   
    window.close();     

}

function finish()
{	
		//alert(http_request.readyState);
	//if(finish_flg==0){
		//if (http_request.readyState == 4) {
	        //if (http_request.status == 200) {
	            //finish_flg = http_request.responseText;
	            //alert(finish_flg);
				if(picture_id!=null)
					document.getElementById(picture_id).style.display = "none";
				if(element_id!=null)
					document.getElementById(element_id).disabled = null;
					
	        //} else {
	            //alert('There was a problem with the request.');
	        //}
	    //}
	//}
}

function GetXmlHttp()
{
	var   XmlHttpProgIds   =   "MSXML2.XMLHttp.4.0,MSXML2.XMLHTTP,Microsoft.XMLHTTP"   
    XmlHttpProgIds   =   XmlHttpProgIds.split(",")   
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
            XmlHttp = new XMLHttpRequest();
			
            if (XmlHttp.overrideMimeType) {
                XmlHttp.overrideMimeType('text/xml');
            }
    }
    else if (window.ActiveXObject) {   
	    for   (var   i   in   XmlHttpProgIds)   
	    {   
	        try   
	        {   
	            XmlHttp   =   new   ActiveXObject(   XmlHttpProgIds[i]   )   
	        }   
	        catch(e)   
	        {   
	            continue   
	        }   
	        break   
	    } 
	}  
}